home *** CD-ROM | disk | FTP | other *** search
/ Interactive Media Design Review 1999 / Interactive Media Design Review 1999.iso / pc / Demos / Herois / Codigo.Cst / 00076_Script_Lista Alfabetica < prev    next >
Text File  |  1999-03-19  |  2KB  |  58 lines

  1. --
  2. -- Gera lista alfabetica e armazena texto e referencias em 
  3. --   ListaAlfabetica e ListaAlfabeticaRef respectivamente
  4. on GeraListaAlfabetica
  5.   global V12dbeFact, V12tblFact
  6.   set V12dbeFact = Xtra "V12dbe"
  7.   set V12tblFact = Xtra "V12table"
  8.   
  9.   abreTextosDB
  10.   abreDB
  11.   
  12.   -- Seleciona todos na lista
  13.   mSetIndex(gArqs,"alfaNdx")
  14.   mSelect(gArqs)
  15.   set counter =  mSelectCount(gArqs)
  16.   
  17.   -- Prepara lista
  18.   set listaAlfabetica = ""
  19.   set listaAlfabeticaRef = ""
  20.   
  21.   repeat while counter > 0
  22.     -- Le registro
  23.     set ai = mGetField(gArqs,"arqNum")
  24.     set titulo = "- " & mGetField(gArqs,"arquivo")
  25.     -- Tira espaco no final do titulo
  26.     set i = length(titulo)
  27.     repeat while i > 0 and char i of titulo = SPACE
  28.       set i = i - 1
  29.     end repeat
  30.     set titulo = char 1 to i of titulo
  31.     put titulo & RETURN after listaAlfabetica
  32.     
  33.     -- Monta lista de indices
  34.     put the number of words in titulo into tmp
  35.     repeat while tmp > 0
  36.       put String(ai) & ", " after listaAlfabeticaRef
  37.       put tmp-1 into tmp
  38.     end repeat   
  39.     
  40.     -- Proxima pagina
  41.     put counter - 1 into counter
  42.     mGoNext(gArqs)
  43.   end repeat
  44.   
  45.   put "0" & RETURN after listaAlfabeticaRef
  46.   set the text of member "ListaAlfabetica" to listaAlfabetica
  47.   set the text of member "ListaALfabeticaRef" to listaAlfabeticaRef
  48.   
  49.   -- Por causa de BUG do V12, precisa-se de abrir e fechar 
  50.   -- gArqs novamente
  51.   fechaDB
  52.   fechaTextosDB
  53.   
  54. end 
  55.  
  56. on carregaListaAlfabetica
  57.   
  58. end